<template>
  <div class="financial-service">
    <Box title="供应链金融服务">
      <div class="main">
        <div class="item">
          <img src="@/assets/longscreen3/service_1.png" alt="" class="img" />
          <div class="data">
            <p class="key">客户{{ amount.name }}</p>
            <p class="val-wrap">
              <count-to
                class="val"
                :startVal="0"
                :endVal="Number(amount.value)"
                :duration="1000"
                :decimals="2"
              ></count-to>
              <span class="unit">{{ amount.unit }}</span>
            </p>
          </div>
        </div>
        <div class="item">
          <img src="@/assets/longscreen3/service_2.png" alt="" class="img" />
          <div class="data">
            <p class="key">客户{{ credit.name }}</p>
            <p class="val-wrap">
              <count-to
                class="val"
                :startVal="0"
                :endVal="Number(credit.value)"
                :duration="1000"
                :decimals="2"
              ></count-to
              ><span class="unit">{{ credit.unit }}</span>
            </p>
          </div>
        </div>
        <div class="item">
          <img src="@/assets/longscreen3/service_3.png" alt="" class="img" />
          <div class="data">
            <p class="key">{{ compCount.name }}</p>
            <p class="val-wrap">
              <count-to
                class="val"
                :startVal="0"
                :endVal="Number(compCount.value)"
                :duration="1000"
              ></count-to
              ><span class="unit">{{ compCount.unit }}</span>
            </p>
          </div>
        </div>
      </div>
    </Box>
  </div>
</template>
    
<script setup>
import Box from "./box.vue";
import { ref, onMounted } from "vue";
import CountTo from "@/components/vueCountTo/vue-countTo.vue";
import { ajax } from "@/store/service";

const amount = ref({ value: 0 });
const credit = ref({ value: 0 });
const compCount = ref({ value: 0 });

const init = async () => {
  const [res] = await ajax.fund();
  amount.value=res.amount
  credit.value=res.credit
  compCount.value=res.compCount
};

onMounted(() => {
  init();
});


</script>

<style scoped lang='scss'>
.financial-service {
  .main {
    height: 382px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 40px;
    box-sizing: border-box;
    .item {
      width: 560px;
      height: 90px;
      margin-bottom: 20px;
      display: flex;
      align-items: center;
      padding: 0 40px;
      box-sizing: border-box;
      background: linear-gradient(
        90deg,
        rgba(44, 64, 107, 0.08) 0%,
        rgba(44, 64, 107, 0.18) 100%
      );

      .img {
        height: 56px;
      }
      .data {
        flex: 1;
        display: flex;
        justify-content: space-between;
        margin-left: 23px;
        .key {
          font-family: SourceHanSansCN, SourceHanSansCN;
          font-weight: bold;
          font-size: 18px;
          color: #c1ddff;
          line-height: 27px;
          letter-spacing: 1px;
          text-align: left;
          font-style: normal;
        }
        .val-wrap {
          font-family: PingFangSC, PingFang SC;
          font-weight: 600;
          font-size: 26px;
          color: #ffffff;
          line-height: 26px;
          text-shadow: 0px 0px 7px rgba(53, 101, 223, 0.82);
          text-align: center;
          font-style: normal;
          .val {
          }
          .unit {
            font-family: SourceHanSansCN, SourceHanSansCN;
            font-weight: 400;
            font-size: 18px;
            color: #c1ddff;
            line-height: 27px;
            text-align: center;
            font-style: normal;
            margin-left: 7px;
          }
        }
      }
    }
  }
}
</style>